Prevent BVT scheduler to be set with a too low ctx_allow by applying
authorvhanquez@kneesa.uk.xensource.com <vhanquez@kneesa.uk.xensource.com>
Thu, 1 Dec 2005 13:13:15 +0000 (13:13 +0000)
committervhanquez@kneesa.uk.xensource.com <vhanquez@kneesa.uk.xensource.com>
Thu, 1 Dec 2005 13:13:15 +0000 (13:13 +0000)
a 10 microsecs low limit to the user parameter.

Signed-off-by: Vincent Hanquez <vincent@xensource.com>
xen/common/sched_bvt.c

index c37b4bf2f950fc08770ea34d09b518ec5b3169d2..37e2f1b7ecb5c0d0d07ab0780c8a00633b7dc387 100644 (file)
@@ -67,6 +67,7 @@ struct bvt_cpu_info
 #define MCU            (s32)MICROSECS(100)    /* Minimum unit */
 #define MCU_ADVANCE    10                     /* default weight */
 #define TIME_SLOP      (s32)MICROSECS(50)     /* allow time to slip a bit */
+#define CTX_MIN        (s32)MICROSECS(10)     /* Low limit for ctx_allow */
 static s32 ctx_allow = (s32)MILLISECS(5);     /* context switch allowance */
 
 static inline void __add_to_runqueue_head(struct vcpu *d)
@@ -297,7 +298,11 @@ static int bvt_ctl(struct sched_ctl_cmd *cmd)
     if ( cmd->direction == SCHED_INFO_PUT )
         ctx_allow = params->ctx_allow;
     else
+    {
+        if ( ctx_allow < CTX_MIN )
+            ctx_allow = CTX_MIN;
         params->ctx_allow = ctx_allow;
+    }
     
     return 0;
 }